package com.ramnight.sql2.component;

import com.alibaba.fastjson.JSONObject;

public class Page {
	private RecList list;
	private int pageNumber;
	private int pageSize;
	private int totalPage;
	private int totalRow;

	public Page(RecList list, int pageNumber, int pageSize, int totalPage, int totalRow) {
		this.list = list;
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
		this.totalPage = totalPage;
		this.totalRow = totalRow;
	}

	public RecList getList() {
		return list;
	}

	public int getPageNumber() {
		return pageNumber;
	}

	public int getPageSize() {
		return pageSize;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public int getTotalRow() {
		return totalRow;
	}
	
	public JSONObject toJSONObject(){
		JSONObject json = new JSONObject();
		json.put("list", list.toJSONArray());
		json.put("pageNumber", pageNumber);
		json.put("pageSize", pageSize);
		json.put("totalPage", totalPage);
		json.put("totalRow", totalRow);
		return json;
	}
}
